package com.longteng.java.web.dblesson.mapper;

import com.longteng.java.web.dblesson.entity.TbUserEntity;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by tianqing.wang
 * DATE : 2018/4/15
 * TIME : 下午3:45
 * PROJECT : web-lesson
 * PACKAGE : com.longteng.java.web.dblesson.mapper
 *
 * @author <a href="mailto:celeskyking@163.com">tianqing.wang</a>
 */
@Component
public class TbUserMapper implements RowMapper<TbUserEntity>{


    @Override
    public TbUserEntity mapRow(ResultSet resultSet, int i) throws SQLException {
        TbUserEntity userEntity = new TbUserEntity();
        userEntity.setId(resultSet.getInt("id"));
        userEntity.setCompany(resultSet.getString("company"));
        userEntity.setLeader(resultSet.getString("leader"));
        userEntity.setTeam(resultSet.getString("team"));
        userEntity.setCreateTime(resultSet.getDate("create_time"));
        userEntity.setUserName(resultSet.getString("username"));
        return userEntity;
    }
}
